<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords"
	content="图片SNS社区,视频SNS社区,音乐SNS社区,个性化圈子,个性化视频,问题发现,问题推荐,问题分享,热点视频,精彩图片,最好音乐" />
<meta name="description"
	content="优问网让你的问题会说话,是一个图片、视频、音乐SNS社区，玩转优问，分享问题，一网打尽全网最热图片、最好看视频、最好听音乐。凭借最快速、最全的热点发掘，独有的圈子体验，在这里你能找到同趣好友，分享热门、搞笑、美女等，尽享视觉社交的最大乐趣。">
<title>找回密码-优问网,发现精彩问题 分享无限快乐</title>
<script type="text/javascript" src="js/jquery1.7.2.js"></script>
<script type="text/javascript" src="js/global.js"></script>
<script type="text/javascript" src="/js/formValidator-4.0.1.js"></script>
<script type="text/javascript" src="/js/formValidatorRegex.js"></script>
<link type="text/css" rel="stylesheet" href="/css/home.css" />
<link type="text/css" rel="stylesheet" href="/css/global.css" />
<link rel="stylesheet" type="text/css" href="/css/validator.css" />
<style type="text/css">
.forgetDiv {
	background: #fff;
	border-radius: 6px;
	min-height: 300px;
	padding: 30px 80px;
	margin-top: 20px;
	box-shadow: 0 0 3px #ccc;
}

.forgetDiv h3 {
	border-bottom: solid 1px #ccc;
	line-height: 40px;
	padding-bottom: 20px;
	margin-bottom: 30px;
	font-size: 18px;
}

.bs_span_large {
	color: #90C43C;
	font-size: 14px;
	font-weight: bold;
}

.bs_span_small {
	color: #90C43C;
	font-size: 12px;
}

.bs_input_label {
	float: left;
	padding-right: 10px;
	text-align: right;
	width: 70px;
	line-height: 30px;
	font-size: 14px;
}

.r3 {
	padding: 7px 10px;
	width: 200px;
}

.blue_button {
	display: block;
	margin: 30px 0 0 95px;
	cursor: pointer;
	font-size: 14px;
	height: 36px;
	line-height: 36px;
	text-align: center;
	width: 124px;
	border-radius: 6px;
	background: #FF5D00;
	color: #fff;
	font-size: 14px;
}

.blue_button:hover {
	color: #fff;
}
</style>
</head>
<body>
	<%@include file="../common/noLoginHead2.jsp"%>
	<div id="container">
		<div class="forgetDiv">
			<h3>找回密码</h3>
			<div>
				<span class="bs_span_large">方法一：</span> <span class="bs_span_small">通过注册邮箱重置密码</span>
				<br> <br>
			</div>
			<form id="form1">
				<div class="forgetForm">
					<label><span class="bs_input_label">注册邮箱:</span> <input
						id="email" class="txt r3" type="text" name="user_email" /></label> 
						<span id="emailTip"></span> <a class="blue_button" onclick="backPwd();">下一步</a>
				</div>
			</form>
		</div>
		<%@include file="../common/footer.jsp"%>
	</div>
	<script type="text/javascript">
		function initValidator() {
			$.formValidator.initConfig({
				formid : "form1",
				onerror : function(msg) {
					alert(msg)
				}
			});
			$("#email").formValidator({
				tipid : "emailTip",
				onShow : "",
				onFocus : "",
				onCorrect : "　 "
			}).regexValidator({
				regExp : regexEnum['email'],
				onError : "邮箱格式不正确"
			}).functionValidator(
					{
						fun : function(val, elem) {
							val = $.trim(val);
							if (val == "") {
								return "请填写邮箱地址";
							}
							// 检测邮箱能否用来注册
							var params = {
								"loginName" : val
							};
							var error = "";
							doAsyncAjax("/userAjax/checkLoginName.action",
									params, function(ajaxResult) {
										if (ajaxResult.OK) {
											error = "此邮箱没有注册过"
										}
									});
							if (error != "") {
								return error;
							}
						}
					}).keyup(function(){
						$(this).triggerHandler('blur');
					});
		}
		initValidator();
		//发送密码找回邮件
		function backPwd(){
			if(!$.formValidator.pageIsValid('1')){
		    	return false;
		    }
			var email = $.trim($("#email").val());
			var params = {"user.loginName":email};
			doAsyncAjax("/processForget.action", params, function(
					ajaxResult) {
				if (ajaxResult.OK) {
					$(".forgetForm").html("修改密码的链接已经发送到您的邮箱，请查收并设置新密码！");
				}else{
					$(".forgetForm").html(ajaxResult.message);
				}
			});
		}
	</script>
</body>
</html>